home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-20 / apl505.zip / MBBIOS.DOC < prev    next >
Text File  |  1990-01-29  |  16KB  |  377 lines

  1. ============================================================================
  2. ;                                                                          ;
  3. ;   Copyright 1986, 1987, 1988 by H. Roy Engehausen.  All rights reserved. ;
  4. ;   This software may be freely distributed and used, but it may not       ;
  5. ;   under any circumstances be sold by anyone other than the author.       ;
  6. ;   It may be distributed by a commercial company as long as it is         ;
  7. ;   for no cost.                                                           ;
  8. ;                                                                          ;
  9. ;   Permission is explicity granted to use this code as a model for        ;
  10. ;   other programs requiring interrupt driven serial I/O as long as they   ;
  11. ;   carry this copyright notice and the imbedded constants                 ;
  12. ;                                                                          ;
  13. ============================================================================
  14.  
  15. MBBIOS is an assembler language program that captures INT 14 (the COM
  16. service call) and extends it with support for the 8250 async port in
  17. buffered mode and adds support for the 8530 PACCOMM PC-100 packet board.
  18. It is configured by the file MBCNF.ASM.  MBBIOS is a resident extension
  19. to DOS and only has to be invoked once.
  20.  
  21.    Copyright 1986, 1987, 1988 by H. Roy Engehausen.  All rights reserved.
  22.    This software may be freely distributed and used, but it may not
  23.    under any circumstances be sold by anyone other than the author.
  24.    It may be distributed by a commercial company as long as it is
  25.    for no cost.
  26.  
  27.    Permission is explicity granted to use this code as a model for
  28.    other programs requiring interrupt driven serial I/O as long as they
  29.    carry this copyright notice and the imbedded constants
  30.  
  31. ================================================================================
  32. !                                                                              !
  33. !  File contents                                                               !
  34. !                                                                              !
  35. ================================================================================
  36.  
  37. Files included are:
  38.  
  39. MBBIOS  .COM   -- The resident program.  Comes configured for COM1 and COM2 as
  40.                 standard ASYNC
  41.  
  42. MBBCONFG.COM   -- Configuration control program
  43. MS400   .MOD   -- How you share interrupts on a DFI MS-400 card
  44.  
  45. This ARC file may contain the source code.  If not, you can get it by
  46. sending an SASE with a standard IBM/PC 5 1/4" or 3 1/2" diskette to me
  47. at 8660 Del Rey Court, Gilroy, California, 95020.  Please format the
  48. disk so I know what density you want.
  49.  
  50. 8250con .asm   -- 8250 hardware constants
  51. 8250ini .asm   -- 8250 initialization
  52. 8250int .asm   -- 8250 interrupt handler
  53. 8250svc .asm   -- 8250 service call handler
  54. 8250svcx.asm   -- 8250 service call handler (extended)
  55. 8250tmr .asm   -- 8250 timer pop handler
  56.  
  57. qrqpcon .asm   -- Quadram QuadPort hardware constants
  58. qrqpini .asm   -- Quadram QuadPort initialization
  59.  
  60. 8530con .asm   -- 8530 hardware constants
  61. 8530ini .asm   -- 8530 initialization
  62. 8530int .asm   -- 8530 interrupt handler
  63. 8530svc .asm   -- 8530 service routines
  64. 8530tmr .asm   -- 8530 timer pop handler
  65. kiss    .asm   -- KISS constants
  66.  
  67. asmmb   .bat   -- BAT routine to assemble MBBIOS
  68.  
  69. mbbios  .asm   -- Main line
  70. mbbcom  .asm   -- Control block format
  71. mbbinit .asm   -- Initialization routine
  72. mbbinter.asm   -- Interrupt handler
  73. mbbload .asm   -- Load MBBIOS
  74. mbbsubr .asm   -- General Subroutines
  75. mbbtimer.asm   -- Timer pop handler
  76. mbbusvc .asm   -- User request service routine
  77.  
  78. mbcnf   .asm   -- ASM file configured for COM1 and two PC-100 ports
  79.  
  80. ================================================================================
  81. !                                                                              !
  82. !  Configuring                                                                 !
  83. !                                                                              !
  84. ================================================================================
  85.  
  86. Use MBBCONFG to configure the tables inside MBBIOS with regards to your
  87. particular hardware configuration.  All ports which share interrupts must be
  88. defined!  Thus if you a port on a PC-1XX, define both ports.  If you use a
  89. port on a MS-400 with the diode modification, you must define all the ports
  90. with diodes on them.
  91.  
  92. ================================================================================
  93. !                                                                              !
  94. !  Parameter explanations                                                      !
  95. !                                                                              !
  96. ================================================================================
  97.  
  98. The HIGH SPEED option is used to shift the data rate table.  See the
  99. explanation on AH=0 below.
  100.  
  101. TRANSMIT BUFFERING allows MBBIOS to return control to the calling
  102. program before the character is fully sent.
  103.  
  104. HARDWARE HANDSHAKING makes MBBIOS follow the RTS/CTS-DTR handshaking
  105. system used by many TNCs.
  106.  
  107. Recommended settings:
  108.  
  109.     Type BBS -->          RLI/MBL/BQE       Host mode (e.g. AA4RE BB)
  110.  
  111.     Transmit Buffering    Try ON.  If       Must be ON
  112.                           you get hangs,
  113.                           OFF
  114.  
  115.     Hardware Handshake    Must be ON        Must be OFF
  116.  
  117. ================================================================================
  118. !                                                                              !
  119. !  Using                                                                       !
  120. !                                                                              !
  121. ================================================================================
  122.  
  123. Simply execute MBBIOS before running the program that needs it.  If you
  124. wish to unload MBBIOS for some reason, issue MBBIOS /U.
  125.  
  126. ================================================================================
  127. !                                                                              !
  128. !  Software Notes                                                              !
  129. !                                                                              !
  130. ================================================================================
  131.  
  132. --------------------------------------------------------------------------------
  133. !                                                                              !
  134. !  ASYNC + Extended Support for BBS                                            !
  135. !                                                                              !
  136. --------------------------------------------------------------------------------
  137.  
  138. MBBIOS supports the standard INT 14 calls plus the extended ones as
  139. defined by Jeff Jacobsen, WA7MBL for his BBS program.  These are
  140. explained below.  AH=0 to AH=3 are identical to the IBM BIOS definition.
  141.  
  142. AH = 0     Initialize
  143. ---------------------
  144.  
  145. This initializes the communications port.  AL contains parity, stop bit,
  146. and word length as in the standard BIOS call.  On return, AH contains
  147. the Line Status Register information (except bit 0 - Data ready tells
  148. whether there is information in the extended buffer rather than the SIO
  149. chip receive buffer).  AL contains the Modem Status Register.
  150.  
  151. The baud rate is selected via AL.  If the high speed option is off, the
  152. rate is a specified for the standard BIOS call.  If the high speed
  153. option is on the speed settings are from the alternate table
  154.  
  155. High speed option off:
  156.  
  157.     MSB                                                     LSB
  158.      7       6       5       4       3       2       1       0
  159.      ----data-rate----       -Parity--    Stopbits   --Word length--
  160.  
  161.      000 -   110             X0 - none      0 - 1    10 - 7 bits
  162.      001 -   150             01 - odd       1 - 2    11 - 8 bits
  163.      010 -   300             11 - even
  164.      011 -   600
  165.      100 -  1200
  166.      101 -  2400
  167.      110 -  4800
  168.      111 -  9600
  169.  
  170. High speed option on:
  171.  
  172.     MSB                                                     LSB
  173.      7       6       5       4       3       2       1       0
  174.      ----data-rate----       -Parity--    Stopbits   --Word length--
  175.  
  176.      000 -    9600           X0 - none      0 - 1    10 - 7 bits
  177.      001 -   14400           01 - odd       1 - 2    11 - 8 bits
  178.      010 -   19200           11 - even
  179.      011 -   28800
  180.      100 -   38400
  181.      101 -   57600
  182.      110 -  115200
  183.      111 -  330400
  184.  
  185. The high speed option can be set either by MBBCONFG or by software
  186. using AH=9 (see below).
  187.  
  188.  
  189.  
  190. AH = 1     Send Character
  191. -------------------------
  192. AL contains the character to send.  Return values are the same as above.
  193.  
  194. AH = 2     Receive Character
  195. ----------------------------
  196.  
  197. On return, AL contains the character received.  AH contains the
  198. composite receive LSR.  This is done by ORing all LSRs on receive
  199. interrupts together.  Therefore the LSR returned does not necessarily
  200. match the LSR for the the character this routine returns).  Again, AH
  201. bit 0 indicates if there is additional characters in the buffer.  This
  202. routine does NOT timeout while waiting for a character but will hang
  203. indefinitely waiting for a character to appear.
  204.  
  205. AH = 3     Return Status
  206. ------------------------
  207.  
  208. Return values are the same as returned by the Initialize routine.
  209.  
  210. AH = 4     Inquiry
  211. ------------------
  212.  
  213. AH returns 0AAH.  AL returns 055H.  This call is used to see if the
  214. MBBIOS driver has been loaded for a particular port.
  215.  
  216. AH = 5     Drop RTS
  217. -------------------
  218.  
  219. This drops DTR (pin 20) and RTS (pin 4).  Used to tell the TNC not to
  220. send any more information.  TNC-1 and PK-232 use pin 4 for handshaking.
  221. TNC-2 uses pin 20 (dont ask me why!)  No return value.
  222.  
  223. AH = 6     Raise RTS
  224. --------------------
  225.  
  226. Raise DTR and RTS.  No return value.
  227.  
  228. AH = 7     Send Break
  229. ---------------------
  230.  
  231. Generates a "Break".  Useful for getting TNC-2 or PK-232 into Command
  232. mode from Converse or Transparent mode.  (However, if the TNC is sending
  233. characters at the time, they will be garbled.)  No return value.
  234.  
  235. AH = 8     Non-destructive Read
  236. -------------------------------
  237.  
  238. Returns the next character in the buffer in AL without removing it from
  239. the buffer.  AH value defined as in AH=2 so you can use the Data Ready
  240. bit to check to see if you really did get a character.
  241.  
  242. AH = 9     Set/Get options
  243. --------------------------
  244.  
  245. Set the current option byte to AL returning the old option byte in AL.
  246. The option byte is defined as follows:
  247.        .......xB    Transmit buffering (1 = on, 0 = off)
  248.        .....x..B    Hardware handshaking (1 = on, 0 = off)
  249.        ..x.....B    High speed option (1 = on, 0 = off)
  250.        xx.xx.x.B    Reserved.  May be in use on other types of devices
  251.  
  252. AH = A     Write buffer
  253. -----------------------
  254.  
  255. Sends CX characters starting at DI:ES.  Upon return, DI will be updated
  256. and CX will contain the unsent character count.  Unsent characters could
  257. result from either BUFFER FULL or hardware handshake is OFF.  AX will
  258. be set as in AH=3 (Status) above.
  259.  
  260. AH = B Read buffer
  261. ------------------
  262.  
  263. Receives up to CX characters starting at DI:ES.  Upon return, CX set to
  264. actual count read and DI is updated.  If the buffer is empty, return is
  265. immediate with CX = 0. On return, AL contains the MSR and AH has the
  266. composite receive LSR.  This is done by ORing all LSRs on receive
  267. interrupts together.  Therefore the LSR returned does not necessarily
  268. match the LSR for the the character this routine returns).  Again, AH
  269. bit 0 indicates if there is additional characters in the buffer.  This
  270. could happen if characters were received between the time of the buffer
  271. movement and the loading of the LSR into AH.
  272.  
  273. --------------------------------------------------------------------------------
  274. !                                                                              !
  275. !  PACCOM PC-100, PC-110, PC-120 support                                       !
  276. !                                                                              !
  277. --------------------------------------------------------------------------------
  278.  
  279. AH = 0     Initialize
  280. ---------------------
  281.  
  282. Parms
  283.   xxx..... = Data rate.  Use same settings as IBM ROM BIOS.
  284.              300 bps = 2, 1200 bps= 4.
  285.  
  286.   ...x.... = Full duplex if 1.  Half duplex if 0.
  287.  
  288.   ....x... = Error packet handler.  0 = throw away all error
  289.              packets.
  290.  
  291.   .....xxx = Don't care.  Use 0 for now!
  292.  
  293. Special case -- If AL = 0 then the COM port is closed!
  294.  
  295. The bits shown are used for parity on an ASYNC port and will be zero for
  296. a KISS interface so it should be compatible with TCP/IP usage of INT 14.
  297.  
  298. AH = 1,2   Send/Receive Characters
  299. ----------------------------------
  300.  
  301. See above.  Packets are handled in KISS format.  Note that all commands
  302. which set time are rounded to the nearest 50ms value.
  303.  
  304. AH = 3     Status
  305. -----------------
  306.  
  307. Returns AH.. AL=0
  308.      0.00000. = not assigned.  Zero
  309.      .x...... = If 0 then packets remain in the transmit queue
  310.      .......x = If 1 then data await in the receive queue
  311.  
  312. These bits correspond to THRE and RDA so are compatible to ASYNC ports
  313.  
  314. AH = 4     Inquiry
  315. ------------------
  316.  
  317. AH returns 0AAH.  AL returns 055H.  This call is used to see if the
  318. MBBIOS driver has been loaded for a particular port.
  319.  
  320. AH = 10    Send a packet
  321. ------------------------
  322.  
  323. ES = Segment of buffer containing the packet to be sent.  Note: The
  324. buffer pointed to by ES will be freed when the packet is sent unless
  325. this is turned off.  It should be gotten via Opcode 12. It must be 512
  326. bytes long and conform to the layout of the buffers
  327.  
  328.             Buffer Layout:
  329.  
  330.                 0 - 503 -- data (504 bytes long)
  331.               504 - 505 -- 16 bit data length
  332.               506       -- flags/status #1
  333.                               x........ = If 1 then don't discard
  334.                                           this buffer after xmt.
  335.                               .x....... = If 1 then this buffer has
  336.                                           been transmitted
  337.                               ..0000000 = not used
  338.               507       -- flags/status #2
  339.                               000000000 = not used
  340.               508 - 509 -- User field.  Not used by MBBIOS
  341.               510 - 511 -- MBBIOS uses as a pointer to next buffer in chain
  342.  
  343. AH = 11    Receive a packet
  344. ---------------------------
  345.  
  346. Returns ES with segment of buffer containing the packet received.  If
  347. zero, no such packet exists.
  348.  
  349. AH = 12    Buffer management
  350. ----------------------------
  351.  
  352. If ES is zero then returns a buffer segment in ES.  If ES is non-zero
  353. then the buffer pointed to is freed.
  354.  
  355. AH = 13    Set TXD -- Time from RTS to start or packet
  356. ------------------------------------------------------
  357.  
  358. AL = new setting in clock counts (54.3 ms)
  359.  
  360. AH = 14    Set P (persistance) -- Controls time from end of DCD to RTS
  361. ----------------------------------------------------------------------
  362.  
  363. AL = new setting.  255 = 1.0
  364.  
  365. AH = 15    Set Slot time -- Controls time from end of DCD to RTS
  366. ----------------------------------------------------------------
  367.  
  368. AL = new setting in clock counts (54.3 ms)
  369.  
  370. AH = 15    Set CRC wait -- time from start of last character to drop RTS
  371. ------------------------------------------------------------------------
  372.  
  373. AL = new setting in clock counts (54.3 ms)
  374.  
  375. Should be 5 character lengths minimum
  376.  
  377.